package com.lugea.common.json;

import java.io.IOException;

import org.joda.time.LocalDate;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdScalarSerializer;

/**
 * @author enluw
 * @date 2020-01-27
 * @描述
 */
public class LocalDateStdScalarSerializer extends StdScalarSerializer<LocalDate> {
    private static final long serialVersionUID = 7515752053697830971L;

    public LocalDateStdScalarSerializer() {
        super(LocalDate.class);
    }

    @Override
    public void serialize(LocalDate localDate, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
            throws IOException {
        jsonGenerator.writeString(localDate.toString());
    }
}
